<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:c="http://java.sun.com/jsp/jstl/core"
   xmlns:p="http://primefaces.org/ui"
   xmlns:our="http://java.sun.com/jsf/composite/components/grid">
   
   <ui:composition template="/admin.xhtml">
   		<ui:define name="page.title">
     		 #{msg['client.register.title']}
   		</ui:define>  

   		<f:metadata name="metadata">
      		<f:viewParam name="searchType" value="#{client.searchType}" />
      		<f:viewParam name="client" value="#{client.current}" converter="clientConverter" />
   		</f:metadata> 

   		<ui:define name="admin.content">
      		<p:spacer height="10" />
      		
      		<h:form id="crud" prependId="false">
         		<p:panel header="#{msg['client.register.title']}" toggleable="true" toggleSpeed="100" toggleTitle="#{msg['client.register.title']}">
            		<p:messages /> 
            		<h:panelGrid columns="3">
            			<h:outputLabel value="#{msg['client.register.label.code']}" />
            			<p:spacer width="10" />
               			<p:inputText id="code" value="#{client.current.code}" disabled="true"/>   
            			
            			<h:outputLabel value="#{msg['client.register.label.name']}" />
            			<p:spacer width="10" />
               			<p:inputText id="name" value="#{client.current.name}"/>  

            			<h:outputLabel value="#{msg['client.register.label.typeDocument']}" />
               			<p:spacer width="10" />
               			<p:inputText id="documentType" value="#{client.current.documentType}"/>
               			
            			<h:outputLabel value="#{msg['client.register.label.document']}" />
               			<p:spacer width="10" />
               			<p:inputText id="document" value="#{client.current.document}"/>   
               			
            			<h:outputLabel value="#{msg['client.register.label.birthday']}" />
               			<p:spacer width="10" />
               			<p:inputMask id="birthday" value="#{client.current.birthday}" mask="99/99/9999"/>   

            			<h:outputLabel value="#{msg['client.register.label.email']}" />
               			<p:spacer width="10" />
               			<p:inputText id="email" value="#{client.current.email}"/>  
               			
            			<h:outputLabel value="#{msg['client.register.label.phone']}" />
               			<p:spacer width="10" />
               			<p:inputMask id="phone" value="#{client.current.email}" mask="(99) 9999-9999"/>           			                			               			              			            			               			               			         			
            		</h:panelGrid>   
               		<h:panelGrid columns="3">
                  		<h:outputText value="#{msg['user.register.label.username']}" />
                  		<p:spacer width="10" />
                  		<p:inputText id="username" value="#{client.current.user.username}" />
                  
                  		<h:outputText value="#{msg['user.register.label.password']}" />
                  		<p:spacer width="10" />
                  		<p:password id="password" value="#{client.current.user.password}" 
                  		feedback="true" inline="true" 
                  		promptLabel="#{msg['user.password.prompt']}"
                     	weakLabel="#{msg['user.password.weak']}"
                     	goodLabel="#{msg['user.password.normal']}"
                     	strongLabel="#{msg['user.password.strong']}" />
                     
                  		<h:outputText value="#{msg['user.register.label.type']}" />
                  		<p:spacer width="10" />
                  		<p:selectOneRadio id="usertype" layout="block" value="#{client.current.user.type}">
                     			<f:selectItems value="#{user.userTypes}" />
                  		</p:selectOneRadio>                  
               		</h:panelGrid>                		
            		<p:commandButton id="save" value="#{msg['crud.save']}" update="@form" process="@form" action="#{client.save}" />              
            		<p:commandButton id="cancel" value="#{msg['crud.cancel']}" async="true" update="crud" immediate="true" />            		     		
         		</p:panel>
         		
         		<p:spacer height="15" />
            
        		<p:panel id="list" toggleable="true" toggleSpeed="100" toggleTitle="#{msg['client.list.title']}" header="#{msg['client.list.title']}">
            		<our:clientTable id="clientList" renderSelect="false"
               		renderEdit="true" renderRemove="true"
               		enableSearch="false" widthActionColumn="90px"
               		value="#{client.current.code}" />               		           
         		</p:panel>         		  
			</h:form>         		    		
   		</ui:define>      		   		  		 	
   </ui:composition>
</html>
